ModuleManager.constructor   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
dl 0
loc 3
rs 10
1
export class ModuleManager {
2
    constructor() {
3
        this.initCheckboxListener()
4
    }
5
6
    initCheckboxListener() {
7
        $("input[type='checkbox'].module-activation").on('click', (event) => {
8
            let element = event.currentTarget
9
            let url = $("meta[name='module-activation-url']").attr('content')
10
11
            $.post(url, {
12
                _token: $("meta[name='csrf-token']").attr('content'),
13
                src_module: $(element).data('module'),
14
                active: $(element).is(':checked') === true ? '1' : '0'
15
            }).then(() => {
16
                let text = $(element).is(':checked') === true ? uctrans.trans('uccello::settings.module_manager.notification.module_activated') : uctrans.trans('uccello::settings.module_manager.notification.module_deactivated')
0 ignored issues
show
Bug introduced by
The variable uctrans seems to be never declared. If this is a global, consider adding a /** global: uctrans */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
17
                M.toast({html: text})
0 ignored issues
show
Bug introduced by
The variable M seems to be never declared. If this is a global, consider adding a /** global: M */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
18
            })
19
            .fail((error) => {
0 ignored issues
show
Unused Code introduced by
The parameter error is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
20
                swal(uctrans.trans('uccello::default.dialog.error.title'), uctrans.trans('uccello::settings.module_manager.error.save'), 'error')
0 ignored issues
show
Bug introduced by
The variable uctrans seems to be never declared. If this is a global, consider adding a /** global: uctrans */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
21
            })
22
        })
23
    }
24
}